home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / pgpwin11 / pgpc.frm < prev    next >
Text File  |  1995-05-08  |  7KB  |  253 lines

  1. VERSION 2.00
  2. Begin Form pgpc 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "PGP Composer ver 1.1"
  5.    ClientHeight    =   6840
  6.    ClientLeft      =   -90
  7.    ClientTop       =   450
  8.    ClientWidth     =   9435
  9.    FontBold        =   -1  'True
  10.    FontItalic      =   0   'False
  11.    FontName        =   "Futura Md BT"
  12.    FontSize        =   8.25
  13.    FontStrikethru  =   0   'False
  14.    FontUnderline   =   0   'False
  15.    Height          =   7245
  16.    Icon            =   PGPC.FRX:0000
  17.    Left            =   -150
  18.    LinkMode        =   1  'Source
  19.    LinkTopic       =   "Form1"
  20.    MaxButton       =   0   'False
  21.    ScaleHeight     =   6840
  22.    ScaleWidth      =   9435
  23.    Top             =   105
  24.    Width           =   9555
  25.    Begin TextBox signas 
  26.       Enabled         =   0   'False
  27.       Height          =   375
  28.       Left            =   6600
  29.       TabIndex        =   9
  30.       Top             =   6240
  31.       Width           =   2655
  32.    End
  33.    Begin CommandButton Command1 
  34.       Caption         =   "&Go"
  35.       Height          =   375
  36.       Left            =   7920
  37.       TabIndex        =   2
  38.       Top             =   5760
  39.       Width           =   1335
  40.    End
  41.    Begin PictureBox Picture1 
  42.       BorderStyle     =   0  'None
  43.       Height          =   495
  44.       Left            =   7200
  45.       Picture         =   PGPC.FRX:0302
  46.       ScaleHeight     =   495
  47.       ScaleWidth      =   615
  48.       TabIndex        =   10
  49.       Top             =   5760
  50.       Width           =   615
  51.    End
  52.    Begin CheckBox issign 
  53.       Caption         =   "&Sign [as]"
  54.       Height          =   255
  55.       Left            =   6600
  56.       TabIndex        =   3
  57.       Top             =   5640
  58.       Width           =   1215
  59.    End
  60.    Begin CommandButton rereadkeys 
  61.       Caption         =   "ReRead &Keys"
  62.       Height          =   375
  63.       Left            =   7920
  64.       TabIndex        =   8
  65.       Top             =   5280
  66.       Width           =   1335
  67.    End
  68.    Begin CheckBox ismore 
  69.       Caption         =   "&Eyes Only"
  70.       Height          =   255
  71.       Left            =   6600
  72.       TabIndex        =   4
  73.       Top             =   5280
  74.       Width           =   1215
  75.    End
  76.    Begin Timer Timer1 
  77.       Interval        =   1000
  78.       Left            =   9600
  79.       Top             =   1800
  80.    End
  81.    Begin ListBox hexlist 
  82.       Height          =   3150
  83.       Left            =   9240
  84.       TabIndex        =   6
  85.       Top             =   960
  86.       Visible         =   0   'False
  87.       Width           =   1815
  88.    End
  89.    Begin ListBox textlist 
  90.       Height          =   4515
  91.       Left            =   6600
  92.       TabIndex        =   5
  93.       Top             =   600
  94.       Width           =   2775
  95.    End
  96.    Begin TextBox pad 
  97.       FontBold        =   -1  'True
  98.       FontItalic      =   0   'False
  99.       FontName        =   "System"
  100.       FontSize        =   9.75
  101.       FontStrikethru  =   0   'False
  102.       FontUnderline   =   0   'False
  103.       Height          =   6015
  104.       Left            =   120
  105.       MultiLine       =   -1  'True
  106.       TabIndex        =   1
  107.       Top             =   600
  108.       Width           =   6375
  109.    End
  110.    Begin TextBox recepients 
  111.       Height          =   375
  112.       Left            =   960
  113.       TabIndex        =   0
  114.       Top             =   120
  115.       Width           =   8415
  116.    End
  117.    Begin Label Label1 
  118.       Caption         =   "To:"
  119.       Height          =   255
  120.       Left            =   120
  121.       TabIndex        =   7
  122.       Top             =   120
  123.       Width           =   615
  124.    End
  125. End
  126. Dim stage As Integer
  127.  
  128. Sub Command1_Click ()
  129.     Open "plaintmp.$$$" For Output As #1
  130.     Print #1, pad.text
  131.     Close (1)
  132.     On Local Error Resume Next
  133.     Kill "enc$tmp.$$$"
  134.     flags$ = "wa"
  135.     rec$ = LTrim$(RTrim$(recepients.text))
  136.     If issign.value Then
  137.         flags$ = flags$ + "s"
  138.         signuser$ = LTrim$(RTrim$(signas.text))
  139.     End If
  140.     If ismore.value Then flags$ = flags$ + "m"
  141.     If rec$ <> "" Then flags$ = flags$ + "e"
  142.     If issign.value And signuser$ <> "" Then
  143.     flags$ = flags$ + " -u """ + signuser$ + """"
  144.     End If
  145.  
  146.     pgpc.caption = "Launching PGP..."
  147.     screen.pointer = 11
  148.     i% = Shell("pgpcomp.pif " + flags$ + " " + rec$, 1)
  149.     stage = 4
  150. End Sub
  151.  
  152. Sub Form_Load ()
  153.     screen.mousepointer = 11
  154.     stage = 3 ' first, we assume have pgpk$tmp.$$$
  155. End Sub
  156.  
  157. Sub getkeys ()
  158.     Do While textlist.listcount
  159.         textlist.RemoveItem 0
  160.         hexlist.RemoveItem 0
  161.     Loop
  162.     If stage = 3 Then
  163.         stage = 0
  164.         On Local Error GoTo nokey3
  165.         Open "pgpk$tmp.$$$" For Input As #1
  166.         While Not EOF(1)
  167.             Input #1, l$
  168.             If Left$(l$, 4) = "pub " Then
  169.                 textlist.AddItem (Mid$(l$, 30))
  170.                 hexlist.AddItem (Mid$(l$, 11, 6))
  171.             End If
  172.         Wend
  173.         Close (1)
  174.         pgpc.caption = "PGP Composer ver 1.1" ' restore just in case.
  175.         screen.mousepointer = 0
  176.     End If
  177.     GoTo fin3
  178. nokey3:
  179.     stage = 1
  180.     Resume fin3
  181. fin3:
  182. End Sub
  183.  
  184. Sub issign_Click ()
  185.     signas.enabled = issign.value
  186. End Sub
  187.  
  188. Sub launchkeys ()
  189.     If stage = 1 Then
  190.         stage = 0
  191.         pgpc.caption = "Scanning Keyring..."
  192.         i% = Shell("pgpkeys.pif -kv", 2)
  193.         stage = 2
  194.     End If
  195. End Sub
  196.  
  197. Sub rereadkeys_Click ()
  198.     On Local Error Resume Next
  199.     Kill "pgpk$tmp.$$$"
  200.     stage = 1
  201. End Sub
  202.  
  203. Sub textlist_DblClick ()
  204.     recepients.text = LTrim$(RTrim$(recepients.text)) + " 0x" + hexlist.list(textlist.listindex)
  205.     pad.SetFocus
  206. End Sub
  207.  
  208. Sub Timer1_Timer ()
  209.     Select Case stage
  210.         Case 1
  211.             launchkeys
  212.         Case 2
  213.             waitforkeys
  214.         Case 3
  215.             getkeys
  216.         Case 4
  217.             stage = 5 ' buy some time
  218.         Case 5
  219.             waitforenc
  220.     End Select
  221. End Sub
  222.  
  223. Sub waitforenc ()
  224.     If stage = 5 Then
  225.         stage = 0
  226.         On Local Error GoTo notyet5
  227.         Open "enc$tmp.$$$" For Input As #1
  228.         Close (1)
  229.         i% = Shell("notepad enc$tmp.$$$", 1)
  230.         End
  231.     End If
  232. notyet5:
  233.         stage = 5
  234.         Resume fin5
  235. fin5:
  236. End Sub
  237.  
  238. Sub waitforkeys ()
  239.     If stage = 2 Then
  240.         stage = 0
  241.         On Local Error GoTo notyet2
  242.         Open "pgpk$tmp.$$$" For Input As #1
  243.         stage = 3
  244.         Close (1)
  245.         GoTo fin2
  246. notyet2:
  247.     stage = 2
  248.     Resume fin2
  249. fin2:
  250.     End If
  251. End Sub
  252.  
  253.